@extends('layouts.admin')

@section('content')
<!-- Page Heading -->
<h1 class="page-header">
	Department - <small>All Departments</small>
	<a href="{{url('departments/create')}}" class="btn btn-info pull-right">
		Add a new department
	</a>
</h1>
<!-- /.row -->	
<div class="row">
	<div class="col-lg-12">
		<div class="table-responsive">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>#</th>
						<th>Short Department Name</th>
						<th>Department Name</th>
						<th>PDF password</th>
						<th>All Department Template</th>
						<th>&nbsp;</th>
						<th>&nbsp;</th>
						<th>&nbsp;</th>
					</tr>
				</thead>
				<tbody>
				@foreach ($departments as $key => $department)
					<tr>
						<th scope="row">{{ $key + 1 }}</th>
						<td>{{ $department->short_department_name }}</td>
						<td>{{ $department->department_name }}</td>
						<td>{{ $department->pdf_password }}</td>
						<td>
							{{ implode(', ', $department->templates->lists('template_name')) }}
						</td>
						<td>
							<a href="{{url('departments/'.$department->id)}}">
								<span class="glyphicon glyphicon-eye-open"></span> Open
							</a>
						</td>
						<td>
							<a href="{{url('departments/'.$department->id.'/edit')}}">
								<span class="glyphicon glyphicon-edit"></span> Edit
							</a>
						</td>
						<td>
							<a href="{{url('departments/'.$department->id.'/delete')}}">
								<span class="glyphicon glyphicon-trash"></span> Delete
							</a>
						</td>
					</tr>
				@endforeach
				</tbody>
			</table>
		</div>	
	</div>
</div>

<div class="row">
	<div class="col-lg-12">
		{{ $departments->links() }}
	</div>
</div>
@stop